let ipt = document.querySelector('input')
        let btn = document.querySelector('button')
        const key = '7ef11f26c9f3886272cc320041564f93'
        function getWeather() {
            let val = ipt.value
            let city = document.querySelector('.city')
            let rept = document.querySelector('.rept')
            let wea = document.querySelector('.wea')
            let tem = document.querySelector('.tem')
            let hum = document.querySelector('.hum')
            let wind = document.querySelector('.wind')
            let winp = document.querySelector('.winp')
            fetch(`https://restapi.amap.com/v3/weather/weatherInfo?city=${val}&key=${key}`)
                .then(response => response.json())
                .then(data => {
                    rept.innerHTML = (data.lives[0].reporttime),
                        wea.innerHTML = (data.lives[0].weather),
                        tem.innerHTML = (data.lives[0].temperature) + '℃',
                        hum.innerHTML = (data.lives[0].humidity),
                        wind.innerHTML = (data.lives[0].winddirection) + '风',
                        winp.innerHTML = (data.lives[0].windpower) + 'km/h'
                }
                );
        }
        btn.onclick = function () {
            getWeather()

        }
        ipt.addEventListener("keyup", function (event) {
            if (event.key == "Enter") {
                 getWeather()
                
                };
        });